<div class="his_infos">
  <div class="left">
    <img src="<%= current_user.image%>" alt="<%= current_user.name%>"/>
  </div>
  <div class="right">
    <h1><%= current_user.name%><a href="">我要发微博</a></h1>
    <p>
      <%if current_user.is_female%>
        <img src="/images/icon_female.gif" alt="女"/>
      <%end%>
      <%if !current_user.is_female%>
        <img src="/images/icon_male.gif" alt="男"/>
      <%end%>
      <span><%= current_user.city%></span>
    </p>
  </div>
</div>
<div class="send-message-block" style="display:none;">
  <% form_for :weibo, :url => '/weibo',:html=>{:method=>:post,:multipart => false} do |f| %>
    <div class="send-message">
      <%= f.text_area :content %>
    </div>
    <input type="submit" vlaue="发布" class="button-send-message"/>
  <%end%>
</div>
<div class="weibo-details">
  <div class="headline"><%= current_user.name%>的微博</div>
  <%= will_paginate @weibos,{:prev_label=>'前一页', :next_label=>'下一页'} %>
  <ul>
    <% @weibos.each do |weibo| %>
      <li>
        <p><a href="/user/<%= h weibo.user.id%>"><%= h weibo.user.name%>：</a><%= h weibo.content%></p>
        <div class="bottom">
          <span class="time"><%= h status_time_ago_in_words(weibo.created_at)%></span>
          <span class="link">
            <% if is_current weibo.user %>
              <%= link_to "删除",weibo_path(weibo),:method=>:delete %> |
            <%end%>
            <% if is_not_my_favorite(current_user,weibo) %>
              <%= link_to '收藏', {:controller => 'favorite', :action => 'create',:weibo=>weibo.id}, {:method => :post } %> |
            <%end%>
            <a href="" class="link-comment">评论(<%=weibo.comments.size()%>)</a>
          </span>
        </div>
        <div class="comment" style="display:none;">
          <% form_for :comment, :url => "/weibo/#{weibo.id}/comment",:html=>{:method=>:post} do |f| %>
            <div class="send-comment">
              <%= f.text_area :content %>
              <input type="hidden" name="comment[weibo_id]" value="<%= h weibo.id%>"/>
              <input type="hidden" name="comment[user_id]" value="<%= h current_user.id%>"/>
              <input type="submit" value="发布" class="button-comment"/>
            </div>
          <%end%>
          <ul>
            <% weibo.comments.each do |comment| %>
              <li>
                <p>
                  <a href=""><%= h comment.user.name%>：</a><%= h comment.content%>
                  (<%= h status_time_ago_in_words(comment.created_at)%>)
                  <% if is_current comment.user %>
                    <%= link_to "删除",comment_path(comment),:method=>:delete %>
                  <%end%>
                </p>
              </li>
            <%end%>
          </ul>
        </div>
      </li>
    <% end %>
  </ul>
  <%= will_paginate @weibos,{:prev_label=>'前一页', :next_label=>'下一页'} %>
</div>
